package com.jzo2o.customer.controller.operation;

import com.jzo2o.common.model.PageResult;
import com.jzo2o.common.model.Result;
import com.jzo2o.customer.model.domain.AgencyCertificationAudit;
import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController("OperationAgencyCertificationAuditController")
@RequestMapping("/operation/agency-certification-audit")
@Api(tags = "运营端 - 机构认证相关接口")
@RequiredArgsConstructor
public class OperationAgencyCertificationAuditController {
    private final IAgencyCertificationAuditService agencyCertificationAuditService;

    @GetMapping("/page")
    @ApiOperation("机构认证分页查询")
    public PageResult<AgencyCertificationAudit> page(@ModelAttribute AgencyCertificationAuditPageQueryReqDTO agencyCertificationAuditPageQueryReqDTO) {
        return agencyCertificationAuditService.servePage(agencyCertificationAuditPageQueryReqDTO);
    }


    @PutMapping("/audit/{id}")
    @ApiOperation("机构认证审核")
    public Result audit(@PathVariable Long id, @RequestParam String rejectReason, @RequestParam Integer certificationStatus) {
        agencyCertificationAuditService.audit(id, rejectReason, certificationStatus);
        return Result.ok();
    }

}
